﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SmallSoft.Language.View.Interface;
using SmallSoft.Language.Presenter.Interface;
using SmallSoft.Language.Presenter.Factory;
using SmallSoft.Language.Model.Interface;

namespace SmallSoft.Language.View
{
    public partial class FormNotify : Form,IFormNotifyView
    {
        private IWordNotifyBase formDataView;
        private IFormNotifyPresenter presenter;
        public FormNotify()
        {
            InitializeComponent();
            InitFormView();

            presenter = NotifyViewPresenterFactory.GetFormNotifyPresenter();
            presenter.NotifyView = this;
        }
        /// <summary>
        /// Init parameter about position before show dialog
        /// </summary>
        public void InitBeforeShow()
        {
            this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
            this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height;           
        }       

        private void FormNotify_Load(object sender, EventArgs e)
        {            
        }

        #region IFormNotifyView Members

        public void InitFormView()
        {
            formDataView = NotifyViewFactory.GetWordNotifyView();
            formDataView.SetParent(this.panel1);
        }

        #endregion

        #region IFormNotifyView Members


        public IWordNotifyBase FormDataView
        {
            get
            {
                return formDataView;
            }             
        }

        #endregion

        #region IFormNotifyView Members


        public Panel GetParentPanel()
        {
            return panel1;
        }

        #endregion



        public void ShowNotify()
        {
            InitBeforeShow();
            ShowDialog();
        }


        public void SetModel(IWordModel model)
        {
            if (presenter!=null)
            {
                presenter.SetModel(model);
            }
        }


        public void InitFormData(IWordModel model)
        {
            formDataView.SetModel(model);
        }


        public void HideNotify()
        {
            this.Hide();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
